package com.atzxh.collection.set;

/**
 * @author 小红同学
 * @create 2022-10-13-11:34
 * @description
 */
@SuppressWarnings({"all"})
public class HashSet_Source {
    public static void main(String[] args) {

        //Set hashSet = new HashSet();

        // 1. new HashSet() 源码  HasSet底层是一个HashMap
//            public HashSet() {
//                map = new HashMap<>();
//            }

        // 2. 模拟一个HashMap的底层结构
        Node[] table = new Node[16];

        Node jack = new Node("jack", null);
        table[2] = jack;

        Node tom = new Node("tom", null);
        jack.next = tom;

        Node cookie = new Node("cookie", null);
        tom.next = cookie;

        System.out.println(table);

    }
}

class Node{
    Object item;
    Node next;

    public Node(Object item, Node next) {
        this.item = item;
        this.next = next;
    }
}